loop { loop { statement --------- } }
class demo { public static void main(String args[]) { for(int n=1;n<=5;n++) { for(int i=1;i<=9;i++) System.out.print(i); System.out.println(); } } }
123456789 123456789 123456789 123456789 123456789
class demo { public static void main(String args[]) { for(int n=1;n<=4;n++) { for(int i=9;i>=0;i--) System.out.print(i); System.out.println(); } } }
9876543210 9876543210 9876543210 9876543210
class demo { public static void main(String args[]) { for( int n=1;n<=4;n++) { for( int i=1;i<=9;i++) System.out.print(i); for( int i=9;i>=1;i--) System.out.print(i); System.out.println(); } } }
123456789987654321 123456789987654321 123456789987654321 123456789987654321
class demo { public static void main(String args[]) { for( int n=9;n>=5;n--) { for( int i=1;i<=n;i++) System.out.print(i); System.out.println(); } } }
123456789 12345678 1234567 123456 12345
class demo { public static void main(String args[]) { for( int n=4;n<=8;n++) { for( int i=1;i<=n;i++) System.out.print(i); System.out.println(); } } }
1234 12345 123456 1234567 12345678
class demo { public static void main(String args[]) { for( int n=1 ; n<=3 ; n++ ) { for( int a=1 ; a<=4 ; a++) for( int i=1 ; i<=9 ; i++ ) System.out.print( i ); System.out.println( ); } } }
123456789123456789123456789123456789 123456789123456789123456789123456789 123456789123456789123456789123456789
class demo { public static void main(String args[]) { for( int n=1;n<=3;n++) { for( int i=9;i>=0;i--) System.out.print(i); for( int i=1;i<=9;i++) System.out.print(i); System.out.println(); } } }
9876543210123456789 9876543210123456789 9876543210123456789
class demo { public static void main(String args[]) { for( int n=9 ; n>=6 ; n-- ) { for( int i=1;i<=n;i++) System.out.print("*"); System.out.println( ); } } }
********* ******** ******* ******
class demo { public static void main(String args[]) { for(int n=4;n<=8;n++) { for( int i=1;i<=4;i++) System.out.print("*"); System.out.println(); } } }
**** ***** ****** ******* ********
class demo { public static void main(String args[]) { for( int i=1 ; i<=9; i++ ) System.out.print( i ); System.out.println( ); for( int i=9 ; i>=1 ; i-- ) System.out.print( i ); } }
123456789 987654321
class demo { public static void main(String args[]) { for( int a=2,b=19;a<=20;a+=2,b-=2) System.out.println(a+" "+b); } }
2 19 4 17 6 15 8 13 10 11 12 9 14 7 16 5 18 3 20 1